<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script >
    // 构造参数
    function User(name) {
        this.name=name;
        this.hello=function () {
            console.log('hello'+this.name)
        }
    }
    var xiaoming = new User("小明");
    xiaoming.hello();
    //直接定义类
    var zhangsan ={
        id:1,
        name:"张三",
        run:function () {
            console.log(name+"在跑")
        }
    }
    zhangsan.run();

</script>
</body>
</html>